Using view transforms
GLM can create many view transforms.
Camera
glm::lookAt(eye, center, up)
.
- eye: the position of the camera (vec3)
- center: the point to look at (vec3)
- up: the camera up direction (vec3)
- returns: mat4 camera matrix
Orthographic projection
glm::ortho(left, right, top, bottom, zNear, zFar)
.
- left, right, top, bottom, zNear, zFar: bounds of the view volume (float)
- returns: mat4 orthographic matrix
Perspective projection
glm::perspective(fovY, aspect, zNear, zFar)
.
- fovY: radians of vertical field of view (float)
- aspect: aspect ratio width/height (i.e. 16/9) (float)
- zNear, zFar: view volume bounds (float)
- returns: mat4 perspective matrix
- Note: near and far keywords are used by many compilers!
Note: near and far keywords are used by many compilers!